<template>
	<view>
		<view class="top-nav">
			<view @click="backBtn">返回</view>
			<view>提供物资信息</view>
			<view>发布</view>
		</view>
		<view class="input1 goods-input1">
			<view class="">物资明细:</view>
			<input class="goods-input" type="text" value="" />
		</view>
		
		<view class="my-location">
			<view class="">
					位置：
			</view>
			<view @click="getLocation" class="my-location-btn">
				获取当前位置
			</view>
		</view>
		<view class="my-location-info">
			<select>
				<option>郑州</option>
				
			</select>
			<select>
				<option>金水</option>
			</select>
		</view>
		<view class="input1">
			<view class="">联系人&nbsp&nbsp&nbsp:</view>
			<input type="text"  v-model="contactsPerson"/>
		</view>
		<view class="input1">
			<view class="">联系电话:</view>
			<input type="text" v-model="mobilePhone"/>
		</view>
		<view class="user-info">
			微信头像：
			<view class="user-head">
		</view>
		</view>
		
		<view class="user-name">
			微信昵称
		</view>
		<view class="att-info">
			注意：<br/>
			1、请核实信息的时效与准确<br/>
			2、有最新消息请及时反馈
		</view>
		<view class="release-btn" @click="submitHelp()">
			发布
		</view>
		<view class="foot-back">
			
		</view>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				contactsPerson: '',
				createTime: '',
				trappedPersons: '',
				mobilePhone: '',
				address: '',
				material: '',
				openId:'',
				baseUrl:"http://weixiaokong.91xiaokong.com/jeecg-boot/"
			}
		},
		onLoad(options) {
			this.openId = options.openId;
			_this = this;
			
		},
		methods: {
			// 返回按钮
			backBtn(){
				uni.navigateBack({
						delta:1
				})
			},
			// 获取位置
			getLocation() {
				uni.getLocation({
					type: 'gcj02', //返回可以用于uni.openLocation的经纬度
					success: function(res) {
						const latitude = res.latitude;
						const longitude = res.longitude;
						uni.openLocation({
							latitude: latitude,
							longitude: longitude,
							success: function() {
								console.log('success');
							}
						});
					},
					fail(err) {
						console.log(err)
					}
				});
	
			},
			// 提交信息
			submitHelp() {
				uni.request({
					url: _this.baseUrl+'rescue/hnjzRescueInformation/list', //仅为示例，并非真实接口地址。
					data: {
						address: _this.address,
						contactsPerson: _this.contactsPerson,
						createTime: moment().format("YYYY-MM-DD HH:mm:ss"),
						trappedPersons: _this.trappedPersons,
						mobilePhone: _this.mobilePhone,
						material: _this.material
					},
					success: (res) => {
						console.log(res);
					},
					fail(err) {
						console.log(err);
					}
				});
			}
		}
	}
</script>

<style>
.top-nav{
	margin: 0 auto;
	width: 90%;
	display: flex;
	justify-content: space-between;
}
.input1{
	margin-top: 30rpx;
	margin-left: 45rpx;
	display: flex;
	align-items: center;
}
.goods-input1{
	align-items: flex-start;
}
.input1 input{
	margin-left: 40rpx;
	width: 70%;
	height: 80rpx;
	border: #000 solid 1rpx;
	border-radius: 40rpx;
}
.input1 .goods-input{
	height: 300rpx;
}
.my-location,
.my-location-info{
	display: flex;
	margin-left: 40rpx;
	margin-top: 30rpx;
}
.my-location-info select{
	margin-left: 90rpx;
	width: 100rpx;
	height: 50rpx;
}
.my-location-btn{
	border: #000 1rpx solid;
	padding: 10rpx;
	border-radius: 20rpx;
}
.user-info{
	display: flex;
	margin-left: 40rpx;
	margin-top: 30rpx;
	font-size: 28rpx;
}
.user-head {
		width: 40rpx;
		height: 40rpx;
		background-color: #baf;
		border-radius: 20rpx;
	}
	.user-name{
		margin-left: 40rpx;
		margin-top: 30rpx;
	}
	.release-btn{
		width: 80%;
		height: 80rpx;
		border: #000 solid 1rpx;
		margin: 50rpx auto;
		border-radius: 50rpx;
		text-align: center;
		line-height: 80rpx;
	}
	.foot-back{
		width: 100%;
		height: 400rpx;
		background-color: #ccc;
	}
	.att-info{
		margin: 10rpx 0 0 45rpx;
		/* font-size: 30rpx; */
		color: #ccc;
	}
</style>
